
package io.github.eiot.ocpp.schema.v2_1;

import java.time.OffsetDateTime;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
    "transactionId",
    "pspRef",
    "status",
    "statusInfo",
    "settlementAmount",
    "settlementTime",
    "receiptId",
    "receiptUrl",
    "vatCompany",
    "vatNumber",
    "customData"
})
public class NotifySettlementRequest {

    /**
     * The _transactionId_ that the settlement belongs to. Can be empty if the payment transaction is canceled prior to the start of the OCPP transaction.
     * 
     * 
     * 
     */
    @JsonProperty("transactionId")
    @JsonPropertyDescription("The _transactionId_ that the settlement belongs to. Can be empty if the payment transaction is canceled prior to the start of the OCPP transaction.\r\n\r\n")
    @Size(max = 36)
    private String transactionId;
    /**
     * The payment reference received from the payment terminal and is used as the value for _idToken_. 
     * 
     * 
     * (Required)
     * 
     */
    @JsonProperty("pspRef")
    @JsonPropertyDescription("The payment reference received from the payment terminal and is used as the value for _idToken_. \r\n\r\n")
    @Size(max = 255)
    @NotNull
    private String pspRef;
    /**
     * The status of the settlement attempt.
     * 
     * 
     * (Required)
     * 
     */
    @JsonProperty("status")
    @JsonPropertyDescription("The status of the settlement attempt.\r\n\r\n")
    @NotNull
    private PaymentStatusEnum status;
    /**
     * Additional information from payment terminal/payment process.
     * 
     * 
     * 
     */
    @JsonProperty("statusInfo")
    @JsonPropertyDescription("Additional information from payment terminal/payment process.\r\n\r\n")
    @Size(max = 500)
    private String statusInfo;
    /**
     * The amount that was settled, or attempted to be settled (in case of failure).
     * 
     * 
     * (Required)
     * 
     */
    @JsonProperty("settlementAmount")
    @JsonPropertyDescription("The amount that was settled, or attempted to be settled (in case of failure).\r\n\r\n")
    @NotNull
    private double settlementAmount;
    /**
     * The time when the settlement was done.
     * 
     * 
     * (Required)
     * 
     */
    @JsonProperty("settlementTime")
    @JsonPropertyDescription("The time when the settlement was done.\r\n\r\n")
    @NotNull
    private OffsetDateTime settlementTime;
    @JsonProperty("receiptId")
    @Size(max = 50)
    private String receiptId;
    /**
     * The receipt URL, to be used if the receipt is generated by the payment terminal or the CS.
     * 
     * 
     * 
     */
    @JsonProperty("receiptUrl")
    @JsonPropertyDescription("The receipt URL, to be used if the receipt is generated by the payment terminal or the CS.\r\n\r\n")
    @Size(max = 2000)
    private String receiptUrl;
    /**
     * *(2.1)* A generic address format.
     * 
     * 
     */
    @JsonProperty("vatCompany")
    @JsonPropertyDescription("*(2.1)* A generic address format.\r\n")
    @Valid
    private Address vatCompany;
    /**
     * VAT number for a company receipt.
     * 
     * 
     * 
     */
    @JsonProperty("vatNumber")
    @JsonPropertyDescription("VAT number for a company receipt.\r\n\r\n")
    @Size(max = 20)
    private String vatNumber;
    /**
     * This class does not get 'AdditionalProperties = false' in the schema generation, so it can be extended with arbitrary JSON properties to allow adding custom data.
     * 
     */
    @JsonProperty("customData")
    @JsonPropertyDescription("This class does not get 'AdditionalProperties = false' in the schema generation, so it can be extended with arbitrary JSON properties to allow adding custom data.")
    @Valid
    private CustomData customData;

    /**
     * The _transactionId_ that the settlement belongs to. Can be empty if the payment transaction is canceled prior to the start of the OCPP transaction.
     * 
     * 
     * 
     */
    @JsonProperty("transactionId")
    public String getTransactionId() {
        return transactionId;
    }

    /**
     * The _transactionId_ that the settlement belongs to. Can be empty if the payment transaction is canceled prior to the start of the OCPP transaction.
     * 
     * 
     * 
     */
    @JsonProperty("transactionId")
    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }

    public NotifySettlementRequest withTransactionId(String transactionId) {
        this.transactionId = transactionId;
        return this;
    }

    /**
     * The payment reference received from the payment terminal and is used as the value for _idToken_. 
     * 
     * 
     * (Required)
     * 
     */
    @JsonProperty("pspRef")
    public String getPspRef() {
        return pspRef;
    }

    /**
     * The payment reference received from the payment terminal and is used as the value for _idToken_. 
     * 
     * 
     * (Required)
     * 
     */
    @JsonProperty("pspRef")
    public void setPspRef(String pspRef) {
        this.pspRef = pspRef;
    }

    public NotifySettlementRequest withPspRef(String pspRef) {
        this.pspRef = pspRef;
        return this;
    }

    /**
     * The status of the settlement attempt.
     * 
     * 
     * (Required)
     * 
     */
    @JsonProperty("status")
    public PaymentStatusEnum getStatus() {
        return status;
    }

    /**
     * The status of the settlement attempt.
     * 
     * 
     * (Required)
     * 
     */
    @JsonProperty("status")
    public void setStatus(PaymentStatusEnum status) {
        this.status = status;
    }

    public NotifySettlementRequest withStatus(PaymentStatusEnum status) {
        this.status = status;
        return this;
    }

    /**
     * Additional information from payment terminal/payment process.
     * 
     * 
     * 
     */
    @JsonProperty("statusInfo")
    public String getStatusInfo() {
        return statusInfo;
    }

    /**
     * Additional information from payment terminal/payment process.
     * 
     * 
     * 
     */
    @JsonProperty("statusInfo")
    public void setStatusInfo(String statusInfo) {
        this.statusInfo = statusInfo;
    }

    public NotifySettlementRequest withStatusInfo(String statusInfo) {
        this.statusInfo = statusInfo;
        return this;
    }

    /**
     * The amount that was settled, or attempted to be settled (in case of failure).
     * 
     * 
     * (Required)
     * 
     */
    @JsonProperty("settlementAmount")
    public double getSettlementAmount() {
        return settlementAmount;
    }

    /**
     * The amount that was settled, or attempted to be settled (in case of failure).
     * 
     * 
     * (Required)
     * 
     */
    @JsonProperty("settlementAmount")
    public void setSettlementAmount(double settlementAmount) {
        this.settlementAmount = settlementAmount;
    }

    public NotifySettlementRequest withSettlementAmount(double settlementAmount) {
        this.settlementAmount = settlementAmount;
        return this;
    }

    /**
     * The time when the settlement was done.
     * 
     * 
     * (Required)
     * 
     */
    @JsonProperty("settlementTime")
    public OffsetDateTime getSettlementTime() {
        return settlementTime;
    }

    /**
     * The time when the settlement was done.
     * 
     * 
     * (Required)
     * 
     */
    @JsonProperty("settlementTime")
    public void setSettlementTime(OffsetDateTime settlementTime) {
        this.settlementTime = settlementTime;
    }

    public NotifySettlementRequest withSettlementTime(OffsetDateTime settlementTime) {
        this.settlementTime = settlementTime;
        return this;
    }

    @JsonProperty("receiptId")
    public String getReceiptId() {
        return receiptId;
    }

    @JsonProperty("receiptId")
    public void setReceiptId(String receiptId) {
        this.receiptId = receiptId;
    }

    public NotifySettlementRequest withReceiptId(String receiptId) {
        this.receiptId = receiptId;
        return this;
    }

    /**
     * The receipt URL, to be used if the receipt is generated by the payment terminal or the CS.
     * 
     * 
     * 
     */
    @JsonProperty("receiptUrl")
    public String getReceiptUrl() {
        return receiptUrl;
    }

    /**
     * The receipt URL, to be used if the receipt is generated by the payment terminal or the CS.
     * 
     * 
     * 
     */
    @JsonProperty("receiptUrl")
    public void setReceiptUrl(String receiptUrl) {
        this.receiptUrl = receiptUrl;
    }

    public NotifySettlementRequest withReceiptUrl(String receiptUrl) {
        this.receiptUrl = receiptUrl;
        return this;
    }

    /**
     * *(2.1)* A generic address format.
     * 
     * 
     */
    @JsonProperty("vatCompany")
    public Address getVatCompany() {
        return vatCompany;
    }

    /**
     * *(2.1)* A generic address format.
     * 
     * 
     */
    @JsonProperty("vatCompany")
    public void setVatCompany(Address vatCompany) {
        this.vatCompany = vatCompany;
    }

    public NotifySettlementRequest withVatCompany(Address vatCompany) {
        this.vatCompany = vatCompany;
        return this;
    }

    /**
     * VAT number for a company receipt.
     * 
     * 
     * 
     */
    @JsonProperty("vatNumber")
    public String getVatNumber() {
        return vatNumber;
    }

    /**
     * VAT number for a company receipt.
     * 
     * 
     * 
     */
    @JsonProperty("vatNumber")
    public void setVatNumber(String vatNumber) {
        this.vatNumber = vatNumber;
    }

    public NotifySettlementRequest withVatNumber(String vatNumber) {
        this.vatNumber = vatNumber;
        return this;
    }

    /**
     * This class does not get 'AdditionalProperties = false' in the schema generation, so it can be extended with arbitrary JSON properties to allow adding custom data.
     * 
     */
    @JsonProperty("customData")
    public CustomData getCustomData() {
        return customData;
    }

    /**
     * This class does not get 'AdditionalProperties = false' in the schema generation, so it can be extended with arbitrary JSON properties to allow adding custom data.
     * 
     */
    @JsonProperty("customData")
    public void setCustomData(CustomData customData) {
        this.customData = customData;
    }

    public NotifySettlementRequest withCustomData(CustomData customData) {
        this.customData = customData;
        return this;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(NotifySettlementRequest.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
        sb.append("transactionId");
        sb.append('=');
        sb.append(((this.transactionId == null)?"<null>":this.transactionId));
        sb.append(',');
        sb.append("pspRef");
        sb.append('=');
        sb.append(((this.pspRef == null)?"<null>":this.pspRef));
        sb.append(',');
        sb.append("status");
        sb.append('=');
        sb.append(((this.status == null)?"<null>":this.status));
        sb.append(',');
        sb.append("statusInfo");
        sb.append('=');
        sb.append(((this.statusInfo == null)?"<null>":this.statusInfo));
        sb.append(',');
        sb.append("settlementAmount");
        sb.append('=');
        sb.append(this.settlementAmount);
        sb.append(',');
        sb.append("settlementTime");
        sb.append('=');
        sb.append(((this.settlementTime == null)?"<null>":this.settlementTime));
        sb.append(',');
        sb.append("receiptId");
        sb.append('=');
        sb.append(((this.receiptId == null)?"<null>":this.receiptId));
        sb.append(',');
        sb.append("receiptUrl");
        sb.append('=');
        sb.append(((this.receiptUrl == null)?"<null>":this.receiptUrl));
        sb.append(',');
        sb.append("vatCompany");
        sb.append('=');
        sb.append(((this.vatCompany == null)?"<null>":this.vatCompany));
        sb.append(',');
        sb.append("vatNumber");
        sb.append('=');
        sb.append(((this.vatNumber == null)?"<null>":this.vatNumber));
        sb.append(',');
        sb.append("customData");
        sb.append('=');
        sb.append(((this.customData == null)?"<null>":this.customData));
        sb.append(',');
        if (sb.charAt((sb.length()- 1)) == ',') {
            sb.setCharAt((sb.length()- 1), ']');
        } else {
            sb.append(']');
        }
        return sb.toString();
    }

    @Override
    public int hashCode() {
        int result = 1;
        result = ((result* 31)+((this.pspRef == null)? 0 :this.pspRef.hashCode()));
        result = ((result* 31)+((this.statusInfo == null)? 0 :this.statusInfo.hashCode()));
        result = ((result* 31)+((this.vatCompany == null)? 0 :this.vatCompany.hashCode()));
        result = ((result* 31)+((this.settlementTime == null)? 0 :this.settlementTime.hashCode()));
        result = ((result* 31)+((this.customData == null)? 0 :this.customData.hashCode()));
        result = ((result* 31)+((int)(Double.doubleToLongBits(this.settlementAmount)^(Double.doubleToLongBits(this.settlementAmount)>>> 32))));
        result = ((result* 31)+((this.receiptUrl == null)? 0 :this.receiptUrl.hashCode()));
        result = ((result* 31)+((this.receiptId == null)? 0 :this.receiptId.hashCode()));
        result = ((result* 31)+((this.transactionId == null)? 0 :this.transactionId.hashCode()));
        result = ((result* 31)+((this.status == null)? 0 :this.status.hashCode()));
        result = ((result* 31)+((this.vatNumber == null)? 0 :this.vatNumber.hashCode()));
        return result;
    }

    @Override
    public boolean equals(Object other) {
        if (other == this) {
            return true;
        }
        if ((other instanceof NotifySettlementRequest) == false) {
            return false;
        }
        NotifySettlementRequest rhs = ((NotifySettlementRequest) other);
        return ((((((((((((this.pspRef == rhs.pspRef)||((this.pspRef!= null)&&this.pspRef.equals(rhs.pspRef)))&&((this.statusInfo == rhs.statusInfo)||((this.statusInfo!= null)&&this.statusInfo.equals(rhs.statusInfo))))&&((this.vatCompany == rhs.vatCompany)||((this.vatCompany!= null)&&this.vatCompany.equals(rhs.vatCompany))))&&((this.settlementTime == rhs.settlementTime)||((this.settlementTime!= null)&&this.settlementTime.equals(rhs.settlementTime))))&&((this.customData == rhs.customData)||((this.customData!= null)&&this.customData.equals(rhs.customData))))&&(Double.doubleToLongBits(this.settlementAmount) == Double.doubleToLongBits(rhs.settlementAmount)))&&((this.receiptUrl == rhs.receiptUrl)||((this.receiptUrl!= null)&&this.receiptUrl.equals(rhs.receiptUrl))))&&((this.receiptId == rhs.receiptId)||((this.receiptId!= null)&&this.receiptId.equals(rhs.receiptId))))&&((this.transactionId == rhs.transactionId)||((this.transactionId!= null)&&this.transactionId.equals(rhs.transactionId))))&&((this.status == rhs.status)||((this.status!= null)&&this.status.equals(rhs.status))))&&((this.vatNumber == rhs.vatNumber)||((this.vatNumber!= null)&&this.vatNumber.equals(rhs.vatNumber))));
    }

}
